<template>
  <el-main style="padding: 0px 0px;" v-model="LineRecords">

    <van-nav-bar title="追加数量" left-text="返回" left-arrow @click-left="onClickLeft" />
    <div class="engcode">
      <div class="font">追加数量：</div>
      <textarea type="text" ref="AddQty" class="tatile_style" v-model="QQQ">{{ QQQ }}</textarea>
    </div>
    <div class="example-body">
      <van-button class="tbutt" size="large" color="steelblue" @click="conf">确认</van-button>
      <van-button class="tbutt" size="large" color="steelblue" @click="onClickLeft">取消</van-button>
    </div>
  </el-main>
</template>

<script>
import { ref, onMounted, onUnmounted } from "vue";
import { Toast, Dialog } from "vant";
import router from "@/router";
export default {
  name: "addQty",
  setup() {
    const AddQty = ref("");
    const LineRecords = ref({});
    const QQQ = ref();
    const conf = e => {
      console.log(LineRecords.value);
      if(!QQQ.value){
        Toast.fail("数量不能为空！");
      }else{
        let obj={};
        obj.id = LineRecords.value.id;
        obj.planQty=parseFloat(QQQ.value);
        console.log(obj);
        DotNet.invokeMethodAsync("Rmac", "UpdateIssueChildPlanQty", JSON.stringify(obj)).then(res => {
          console.log(res);
          LineRecords.value.planQty=parseFloat(LineRecords.value.planQty)+parseFloat(QQQ.value);
          console.log(LineRecords.value)
          router.push({
            name: "DZCL",
            params: { data:LineRecords.value }
          });
        });
      }
    };
    const conce = e => { };
    const codeWhow = (e) => {
      if (e.keyCode == 13) {
        if (!gdbh.value) {
          console.log("ddd", e)
        }
      }
    }
    const upco = (event) => {
      switch (event.type) {
        case "focus":
          event.target.style.backgroundColor = 'white'
          break
        case "blur":
          event.target.style.backgroundColor = "#eeeeee"
          break
        default:
          break
      }
    }
    const onClickLeft = () => {
      router.push({
          name: "Feeding",
          params: {data:LineRecords.value}
        });
    };
    onMounted(function () {
      LineRecords.value = router.currentRoute.params.data;
    })
    return {
      AddQty,
      LineRecords,
      QQQ,
      conf,
      conce,
      onClickLeft
    }
  }
}
</script>
<style>
.engcode {
  display: flex;
}

.FHimg {
  text-align: left;
  padding: 10px 0 0 10px;

}

.font {
  text-align: lert;
  font-size: 40px;
  /* font-family: "Lucida Calligraphy", cursive, serif, sans-serif; */
  font-weight: bold;
  color: white;
  padding-left: 10px;
  height: 50px;
  padding-top: 20px;
  width: 200px;
  /* margin: 20px 10px; */
}

.tatile_style {
  background-color: #EEEEEE;
  resize: none;
  width: 400px;
  height: 50px;
  margin-left: 10px;
  margin-top: 20px;
}

#app {
  position: relative;
}

.engcode {
  position: absolute;
  left: 10%;
  top: 20%;
}

.example-body {
  display: flex;
  justify-content: space-evenly;
  bottom: 0;
  clear: both;
  margin-top: 20px;
  width: 100%;
  vertical-align: bottom;
  position: absolute;
  bottom: 50px
}

.tbutt {
  margin-right: 5px;
  border-radius: 15px;
  font-size: 20px;
  width: 15%;
  box-shadow: 0px 5px 19px 0px darkblue;

}
</style>